<script lang="ts" setup>
import { EChartsOption } from 'echarts'

const options: EChartsOption = reactive({
  tooltip: {
    trigger: 'axis',
    axisPointer: {
      type: 'shadow'
    }
  },
  legend: {
    data: ['服装', '电子产品', '家居用品', '图书', '美妆', '食品', '玩具']
  },
  grid: {
    left: '3%',
    right: '4%',
    bottom: '3%',
    containLabel: true
  },
  xAxis: [
    {
      type: 'category',
      data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
    }
  ],
  yAxis: [
    {
      type: 'value'
    }
  ],
  series: [
    {
      name: '服装',
      type: 'bar',
      stack: '商品销售',
      emphasis: {
        focus: 'series'
      },

      data: [320, 332, 301, 334, 390, 330, 320]
    },
    {
      name: '电子产品',
      type: 'bar',
      stack: '商品销售',
      emphasis: {
        focus: 'series'
      },
      data: [120, 132, 101, 134, 90, 230, 210]
    },
    {
      name: '家居用品',
      type: 'bar',
      stack: '商品销售',
      emphasis: {
        focus: 'series'
      },
      data: [220, 182, 191, 234, 290, 330, 310]
    },
    {
      name: '图书',
      type: 'bar',
      stack: '商品销售',
      emphasis: {
        focus: 'series'
      },
      data: [150, 232, 201, 154, 190, 330, 410]
    },
    {
      name: '美妆',
      type: 'bar',
      stack: '商品销售',
      emphasis: {
        focus: 'series'
      },
      data: [862, 1018, 964, 1026, 1679, 1600, 1570]
    },
    {
      name: '食品',
      type: 'bar',
      stack: '商品销售',
      emphasis: {
        focus: 'series'
      },
      barWidth: 40,
      markLine: {
        lineStyle: {
          type: 'dashed'
        },
        data: [[{ type: 'min' }, { type: 'max' }]]
      },
      data: [620, 732, 701, 734, 1090, 1130, 1120]
    },
    {
      name: '玩具',
      type: 'bar',
      stack: '商品销售',
      emphasis: {
        focus: 'series'
      },
      data: [60, 72, 71, 74, 190, 130, 110]
    }
  ]
})
</script>

<template>
  <SpEcharts :option="options" height="400px" title="销售情况"> </SpEcharts>
</template>

<style scoped></style>
